<template>
  <div class="detail_wrapper">
    <!-- 标题 -->
    <div class="title_container">
      <h2>{{ hosDetailByHosname?.hospital.hosname }}</h2>
      <div class="level">
        <el-icon><Star /></el-icon>
        <span>{{ hosDetailByHosname?.hospital.param.hostypeString }}</span>
      </div>
    </div>
    <!-- logo及路线 -->
    <div class="logo-route">
      <img class="hospital-img" :src="logoUrl" />
      <div class="m-20">
        具体地址：{{ hosDetailByHosname?.hospital.param.fullAddress }}
        <br />
        规划路线：{{ hosDetailByHosname?.hospital.route }}
      </div>
    </div>
    <!-- 医院介绍 -->
    <div class="introduce">医院介绍</div>


    <div class="intro">{{ hosDetailByHosname?.hospital.intro }}</div>

    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref, onMounted } from "vue";
import { useRoute } from "vue-router";
export default defineComponent({
  name: "detail",
});
</script>

<script setup lang="ts">
import type { typeHosDetailByHosname } from "@/api/registration";
import { reqHosDetailByHosname } from "@/api/registration";
//数据1：动态路由传入的参数
const code = ref("");
const route = useRoute();
//数据2: 医院预约挂号详情
const hosDetailByHosname = ref<typeHosDetailByHosname>();
//数据3：base64格式图片logo
const logoUrl = ref("");
//方法1:获取医院预约挂号详情
const getHosDetailByHosname = async () => {
  try {
    const result = await reqHosDetailByHosname(code.value);
    console.log("预约挂号详情", result);
    hosDetailByHosname.value = result;
    logoUrl.value = "data:image/png;base64," + result.hospital.logoData;
  } catch (error) {}
};
onMounted(() => {
  console.log("home/route:::", route.query);
  code.value = route.query.code as string;
  //初始化2:获取医院预约挂号详情
  getHosDetailByHosname();
});
</script>

<style scoped>
.detail_wrapper {
  flex-grow: 1;
  flex: 1;
  padding: 20px;
}
/* 标题 */
.title_container {
  display: flex;
}
.title_container h2 {
  margin-top: 0;
  margin-bottom: 0.5em;
  font-size: 21px;
  color: #000000d9;
  font-weight: 500;
}
.title_container .level {
  margin-left: 10px;
  margin-top: 5px;
}

.title_container .level span {
  font-size: 16px;
}
/* logo-route */
.logo-route {
  display: flex;
}
.hospital-img {
  width: 80px;
  height: 80px;
  border-radius: 40px;
  margin-left: 10px;
  transition: all 0.2s linear;
  /* background-color: #000;  */
}
.m-20 {
  margin: 20px;
  flex: 1;
  font-size: 14px;
  line-height: 20px;
}
.m-20 h3 {
  margin-top: 0;
  margin-bottom: 0.5em;
  color: #000000d9;
  font-weight: 500;
}
.m-r-10 {
  margin-right: 10px;
  font-size: 14px;
}
/* 医院介绍 */
.introduce{
    font-size: 14px;
    color: #000;
    padding-left: 10px;
}
.intro{
  font-size: 14px;
  line-height: 25px;
}
</style>
